﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ITAP.ShprossesBuilder.Properties;
using ITAP.ShprossesBuilder.Editor;

namespace ITAP.ShprossesBuilder.Operations
{
    public class OperationNew : IOperation
    {
        #region IOperation Members

        public string Name
        {
            get { return "Создать раскладку"; }
        }

        public OperationGroup OperationGroup
        {
            get { return OperationGroup.Other; }
        }

        public System.Drawing.Image Thumbnail
        {
            get { return Resources.NewIcon; }
        }

        public void Execute(ModelControl modelControl)
        {
            modelControl.ModelContainer.RemoveAllInnerComponents();
            SelectShapesForm selectShapesForm = new SelectShapesForm();
            if (selectShapesForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                modelControl.ModelContainer.Initialize(selectShapesForm.CellRepository);
                modelControl.SetCameraToCenter();
            }


        }

        public bool CanUndo
        {
            get { return false; }
        }

        #endregion
    }
}
